<?PHP
error_reporting(E_ALL);
include('object.php');
define('DS',DIRECTORY_SEPARATOR);
include('3rdParty/addendum/annotations.php');

function __autoload($className) {
	if(eregi('[\.\.]',$className)) die('Invalid class name: '.$className);
	else {
		$localPath = strtolower(str_replace('_',DS,$className)).'.php';	
		if(file_exists(Octopus::$frameworkPath.DS.$localPath)) 
			include(Octopus::$frameworkPath.DS.$localPath);
		else if(file_exists(Octopus::$frameworkPath.DS.'annotations'.DS.$localPath)) {
			include(Octopus::$frameworkPath.DS.'annotations'.DS.$localPath);
		}
		else throw new Exception_ClassNotFound('Not implemented/found.');
	}
}
function fix_separator($str) {
	if(DS == '/') $str = str_replace('\\','/',$str);
	else $str = str_replace('/','\\',$str);
	return $str;
}
function profile($n) {
	static $profiles=array();
	if(isset($profiles[$n])) return round((microtime(true)-$profiles[$n]),4);
	else $profiles[$n] = microtime(true);
}
function o($api) {
	return octopus::load($api);
}
?>